import {service as request} from '@/utils/request'

//添加业务系统
export function doAdd (data) {
    return request({
        url: '/hawk/business/save',
        method: 'post',
        data: {
            ...data,
            "hostCount": 0,
            "problemCount": 0
        }
    })
}
//批量删除
// leo 5.2
export function doDelete (ids) {
    return request({
        url: `/hawk/business/del`,
        method: 'delete',
        data:ids

    })
}
//编辑业务系统
// leo 5.9
export function doEdit (data) {
    return request({
        url: `/hawk/business/update`,
        method: 'put',
        data
    })
}

//分页条件查询
// leo 5.8
export function getList (data) {
    return request({
        url: `/hawk/business/search/${data.page.current}/${data.page.size}`,
        method: 'get',
        params:data.query

    })
}

/**
 * 获得业务系统下的 告警配置
 * @param {*} id 
 * @returns 
 * 5.5 根据id获取业务系统
 */
export function getAlarmBybsId (id) {
    return request({
        url: `/hawk/business/get/${id}`,
        method: 'get',
    })
}


// 配置告警
export function searchAlarm (id, type) {
    return request({
        url: `/monitor/config/business/alarm/${id}/${type}`,
        method: 'get',
    })
}

/**
 * 为业务系统添加告警配置
 * 5.1
 * @param {*} data 
 * @returns 
 */
export function editAlarm (data) {
    return request({
        url: `/hawk/business/assign/alarm/${data.businessid}`,
        method: 'post',
        data
    })
}

export function addAlarm (data) {
    return request({
        url: `/hawk/business/assign/alarm/${data.businessid}`,
        method: 'post',
        data
    })
}


/**
 * 删除告警信息
 * @param {*} id  业务系统的 ID  
 * @returns 
 */
export function deleteAlarm (id) {
    return request({
        url: `/hawk/business/remove/alarm/${id}`,
        method: 'delete',
    })
}
